package com.jk.controller;

import com.jk.po.OrderPO;
import com.jk.service.YuDingService;
import com.jk.utils.GenerateNum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/***
 * @ClassName: YuDingController
 * @Description:TODO
 * @Auther: 景晨璇
 * @Date: 2021/7/7 14:34
 * @version : V1.0
 */
@RestController
@RequestMapping("yuding")
@Api("订单")
public class YuDingController {
    @Autowired
    private YuDingService yuDingService;

    @PostMapping("addyuding")
    @ApiOperation("提交订单")
    public void addYuDing(@RequestBody OrderPO orderPO){
        //下单时间
        orderPO.setCreationtime(new Date());
        //订单状态
        orderPO.setOrderstatus(2);
        //订单编号
        orderPO.setOrdernumber(GenerateNum.getInstance().GenerateOrder());

        yuDingService.addYuDing(orderPO);
    }
}
